{block name='content'}
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body padding-40 margin-bottom-40">
        <div class="layui-form-item layui-row layui-col-space15">
            <div class="layui-col-xs4 block relative">
                <span class="color-green">设备名称</span><span class="margin-left-5 color-desc">Device Name</span>
                <input class="layui-input disabled" readonly value="{$devices[$vo.d_id]}">
            </div>

            <label class="layui-col-xs4 block relative">
                <span class="color-green label-required-prev">箱格类型</span><span class="margin-left-5 color-desc">Box Type</span>
                <select class="layui-select set_name" lay-search name="box_type">
                    <option value="">请选择 箱格类型</option>
                    {foreach name="$box_types" id="val"}
                    {if isset($vo.box_type) AND $vo.box_type eq $key}
                    <option selected value="{$key}">{$val}</option>
                    {else}
                    <option value="{$key}">{$val}</option>
                    {/if}
                    {/foreach}
                </select>
            </label>

            <label class="layui-col-xs4 block relative">
                <span class="color-green label-required-prev">箱格状态</span><span class="margin-left-5 color-desc">Box Type</span>
                <select class="layui-select" lay-search name="box_status">
                    <option value="">请选择 箱格类型</option>
                    {foreach name="$box_status" id="val"}
                    {if isset($vo.box_status) AND $vo.box_status eq $key}
                    <option selected value="{$key}">{$val}</option>
                    {else}
                    <option value="{$key}">{$val}</option>
                    {/if}
                    {/foreach}
                </select>
            </label>
        </div>

        <div class="layui-form-item layui-row layui-col-space15">
            <label class="layui-col-xs4 block relative">
                <span class="color-green label-required-prev">设备版号</span><span class="margin-left-5 color-desc">Device Board</span>
                <input min="1" class="layui-input" name="device_board" lay-verify="required" required value="{$vo.device_board|default=''}" placeholder="请输入 设备版号">
            </label>

            <label class="layui-col-xs4 block relative">
                <span class="color-green label-required-prev">版通道号</span><span class="margin-left-5 color-desc">Board Channel</span>
                <input min="1" class="layui-input" name="board_channel" lay-verify="required|number" required value="{$vo.board_channel|default=''}" placeholder="请输入 版通道号">
            </label>

            <label class="layui-col-xs4 block relative">
                <span class="color-green label-required-prev">箱门编号</span><span class="margin-left-5 color-desc">Box Number</span>
                <input min="1" class="layui-input" name="box_num" lay-verify="required|number" required value="{$vo.box_num|default=''}" placeholder="请输入 箱门号">
            </label>
        </div>

        <div class="layui-form-item layui-row layui-col-space15">
            <label class="layui-col-xs6 block relative">
                <span class="color-green label-required-prev">使用人身份</span><span class="margin-left-5 color-desc">User Type</span><br>
                <div class="layui-input-inline">
                    {assign  name="user_type" value="$vo.user_type|default=1"}
                    <input type="radio" name="user_type" value="1" title="系统" {if $user_type==1}checked{/if}>
                    <input type="radio" name="user_type" value="0" title="普通" {if $user_type!=1}checked{/if}>
                </div>
            </label>
            <label class="layui-col-xs6 block relative">
                <span class="color-green">备注</span><span class="margin-left-5 color-desc">Box Number</span>
                <input class="layui-input" name="remark" value="{$vo.remark|default=''}" placeholder="请输入 备注">
            </label>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        {if $title!="查看柜点"}
        <button class="layui-btn" lay-submit lay-filter="submit">保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close="">取消编辑</button>
        {/if}
    </div>
</form>

{/block}

{block name='script'}
<script>
    (function () {
        var title = "{$title}";
        if(title=='查看柜点'){
            $("input,select").attr("readOnly", true);
        }
        layui.form.on('radio', radios);
        layui.form.render();

        function radios(data) {
            let key = $(this).prop('name');
            $("input[name="+key+"]").val(data.value);
        }
    })();
</script>
{/block}